<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ include file="/resources/modular/plugin/taglibs.jsp" %>
<!doctype html>
<head content="-我的">
    <%@ include file="/resources/modular/head/inside_head.jsp" %>
</head>
<body class="GC_Menu_7" name="GC_indvidual">

<%@ include file="/resources/modular/plugin/mainMenu.jsp" %>

<div class="page" name="GC_individual_editbottomtext">

    <%@ include file="/resources/modular/plugin/mainTopMenu.jsp" %>

    <%@ include file="/resources/modular/plugin/individualMeun.jsp" %>

    <div class="page_right">
        <div class="my_addTextdv">
            <p>
                <span class="my_addTextval"><%--游艺设备 • 智能物联--%>${bottomcontent}</span>
                <a class="my_addTextbtn" href="javascript:;">修改</a>
            </p>
            <p class="my_addTextp1">
                <input type="text" id="GC_bottomcontent" placeholder="${bottomcontent}">
                <a class="my_addTextbtn1" href="javascript:;">保存</a>
                <a class="my_addTextbtn2" href="javascript:;">取消</a>
            </p>
        </div>
    </div>

</div>
</body>
</html>
<%@ include file="/resources/modular/foot/inside_footer.jsp" %>
<script>

    var regText=/^.{1,30}$/;

    //my_addText.html页面
    $(".my_addTextbtn").on("click", function(){
        $(".my_addTextp1").css({"transition":"all 0.2s","left":"0px"});
    });
    //取消
    $(".my_addTextbtn2").on("click", function(){
        $(".my_addTextp1").css({"transition":"all 0.1s","left":"950px"});
    });
    //保存
    $(".my_addTextbtn1").on("click", function(){
        var my_addTextvalue=$(this).prev("input").val();
        if(regText.test(my_addTextvalue)){
            saveContent(my_addTextvalue);
            /*$(".my_addTextval").text(my_addTextvalue);
             $(".my_addTextp1").css({"transition":"all 0.1s","left":"950px"});*/
        }
    });
    <%-- 保存底部文字 --%>
    function saveContent(editcontent) {

        if(typeof(editcontent) != "undefined" && editcontent.length > 0){
            $.ajax({
                url: '${basePath}v2/individual/editContent',
                type: 'POST',
                data: {
                    "content": $("#GC_bottomcontent").val()
                },
                error: function (response) {
                    $errorMsg(response);
                },
                success: function (ret) {
                    if (ret.result) {
                        $(".my_addTextval").text(editcontent);
                        $(".my_addTextp1").css({"transition":"all 0.1s","left":"950px"});
                        alert("编辑底部文字成功","cur");
                    } else {
                        alert(ret.info,"cur");
                    }
                }
            });
        }else{
            alert("底部文字不能为空","cur");
        }
    }

</script>